<?php

class MY_Controller extends CI_Controller {

    function __construct() {
        parent::__construct();
        $this->sess = toObject($this->session->userdata);
    }

    function myview($data, $view = 'home/index', $all = false, $isadmin = 0, $def = "default") {
        $data["view"] = $view == "" ? "home/index" : $view;
        if (@$this->sess->mpa_id_alumni == "" && $all == false) {
            $this->session->set_flashdata("redir", "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
            $data["view"] = "alumni/login";
        }
        if ($isadmin == 1 && @$this->sess->isadmin != 1) {
            $data["view"] = "alert/warning";
        }
        $this->load->view($def, $data);
    }

    function mypopup($title, $data, $view = '') {
        $data["title"] = $title;
        $data["view"] = $view;
        $this->load->view("popup", @$data);
    }

    function paging($url, $total_rows, $per_page, $uri_segment = 3, $num_links = 10) {
        $this->load->library('pagination');
        $config['base_url'] = $url;
        $config['total_rows'] = $total_rows;
        $config['per_page'] = $per_page;
        $config['uri_segment'] = $uri_segment;
        $config['num_links'] = $num_links;
        $this->pagination->initialize($config);
    }

    function popuppaging($url, $total_rows, $per_page, $uri_segment = 3, $num_links = 10) {
        $this->load->library('paginationpopup');
        $config['base_url'] = $url;
        $config['total_rows'] = $total_rows;
        $config['per_page'] = $per_page;
        $config['uri_segment'] = $uri_segment;
        $config['num_links'] = $num_links;
        $this->paginationpopup->initialize($config);
    }

}

?>
